function writeText2Tex(fid,textInput) 
%% function writeText2Tex(fid,textInput) 
% fid:          File identifier
% textInput:    Cell or a structure
%
% textInput will be written as simple TEX text leaving a blank line above and
% below both in Matlab and using \vspace{}
fprintf(fid,'\n');
fprintf(fid,'\\vspace{0.15in} \n');
if isstruct(textInput)==true
    names=fieldnames(textInput);
    Ncontent=length(names);
    for ii=1:Ncontent;
        fldnm=char(names(ii));
        str=char(textInput.(fldnm));
        if ii==1;
            str=strcat('\\{',str);
        elseif ii==Ncontent
            str=strcat(str,'}');
        end
        if ii < Ncontent
            fprintf(fid, [str,' \\\\ \n']);
        else
            fprintf(fid, [str,' \n']);
        end
    end
else
    %% 3.2 if a cell
    if iscell(textInput)==true
        textInput=textInput(:);
        Ncontent=length(textInput);
        for ii=1:Ncontent;
            str=char(textInput(ii,:));
            if ii==1;
                str=strcat('{',str);
            elseif ii==Ncontent
                str=strcat(str,'}');
            end
            if ii < Ncontent
                fprintf(fid, [str,' \\\\ \n']);
            else
                fprintf(fid, [str,' \n']);
            end
        end
    end
end
fprintf(fid,'\\vspace{0.15in} \n');

